﻿using System.Diagnostics;

using JetBrains.Annotations;

namespace octalforty.Componento.Core.Util
{
    public static class TraceSourceExtensions
    {
        public static TraceSource Begin(this TraceSource trace)
        {
            Trace.Indent();
            return trace;
        }

        public static TraceSource End(this TraceSource trace)
        {
            Trace.Unindent();
            return trace;
        }

        [StringFormatMethod("format")]
        public static void WriteLine(this TraceSource trace, TraceEventType eventType, string format, params object[] args)
        {
            trace.TraceEvent(eventType, 0, format, args);
        }
    }
}
